package guda.screenshot;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
 * Created by foodoon on 2014/12/28.
 */
public class ScreenHelper {

    public static void shot() throws Exception {
        String property = System.getProperty("user.dir");
        Robot robot = new Robot();

        BufferedImage screenShot = robot.createScreenCapture(
                new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
        ImageIO.write(screenShot, "JPG", new File(property + "/screenShot.jpg"));

    }
}
